package com.acwing.partition12;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/2/9 11:40
 */
public class AC1123铲雪车 {

    private static final BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
    private static final BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        String[] ss = reader.readLine().split(" ");
        int x = Integer.parseInt(ss[0]), y = Integer.parseInt(ss[1]);
        double sum = 0;
        while (true) {
            String s = reader.readLine();
            if (s == null || s.isEmpty()) break;
            ss = s.split(" ");
            int a = Integer.parseInt(ss[0]), b = Integer.parseInt(ss[1]), c = Integer.parseInt(ss[2]), d = Integer.parseInt(ss[3]);
            sum += Math.sqrt(Math.pow(a - c, 2) + Math.pow(b - d, 2)) * 2;
        }
        int minutes = (int) Math.round(sum / 1000 / 20 * 60), hours = minutes / 60;
        minutes %= 60;
        writer.write(String.format("%d:%02d\n", hours, minutes));
        writer.flush();
    }
}
